<?php
declare (strict_types=1);

namespace app\index\controller;

use app\common\tool\Result;
use think\facade\View;
use think\exception\ValidateException;

class Security extends Base
{

    public function index()
    {
        return View::fetch();
    }

    public function mobile()
    {
        return View::fetch();
    }

    public function password()
    {
        return View::fetch();
    }

    public function save()
    {
        $param = $this->request->post();
        try {
            $this->validate($param, 'Security');
        } catch (ValidateException $e) {
            return Result::fail($e->getError());
        }
        return Result::fastReturn(\app\common\model\User::security($param, $this->user));
    }

}

